/**
 * 小区介绍
 * @author truexin
 * @date   2016/05/30
 */
(function (lf, r) {

    var ajax = lf.utils.ajax,
        RC = r.createClass;

    var Body = RC({
        getInitialState: function () {
            return ({
                list: '',
            })
        },
        componentDidUpdate: function () {
            var node = r.findDOMNode(this.refs.innerHtml);
            node.innerHTML = this.state.list;
        },
        componentWillMount: function () {
            var me = this,
                user = me.props.user;

            ajax({
                type: 'get',
                data: {
                    projectId: user.projectId,
                },
                success: function (data) {
                    var dataList = data.data;
                    me.setState({
                        list: dataList.introduce
                    });
                }.bind(me)
            }, lf.finger.api.project);

        },
        render: function () {
            return (
                <div className="property-intro">
                    <div className="rich-text" ref="innerHtml"></div>
                </div>
            );
        }
    });

    lf.appJs.getUser(function (user) {
        r.render(
            <Body user={user}/>,
            document.getElementById('root'), function () {
            }
        )
    })

})(liefeng, React)
